let hotQuestionsApp = new Vue({
    el:'#hotQuestionsApp',
    data:{
        questions:[
            // {title:'第1个问题',hits:10,statusText:'已解决',statusClass:'text-success'},
            // {title:'第2个问题',hits:20,statusText:'未回复',statusClass:'text-warning'},
            // {title:'第3个问题',hits:30,statusText:'未解决',statusClass:'text-info'},
            // {title:'第4个问题',hits:40,statusText:'已解决',statusClass:'text-success'},
            // {title:'第5个问题',hits:50,statusText:'未回复',statusClass:'text-warning'}
        ]
    },
    methods:{
        loadHotQuestions:function () {
            // alert("准备加载热点问题！")
            $.ajax({
                url:'/api/v1/questions/hot-list',
                success:function (json) {
                    let list = json.data
                    let statusTexts = ['未回复','未解决','已解决']
                    let statusClasses = ['text-warning','text-info','text-success']
                    for (var i=0;i<json.data.length;i++){
                        hotQuestionsApp.questions.push({
                            title: json.data[i].title,
                            hits:json.data[i].hits,
                            statusText:statusTexts[json.data[i].status],
                            statusClass:statusClasses[json.data[i].status]
                        })
                    }

                }
            })
        }
    },
    created:function () {
        this.loadHotQuestions()
    }
})